package com.kyzh.core.utils

import android.util.Log
import androidx.appcompat.app.AppCompatActivity
import com.gushenge.atools.util.ASystem
import com.gushenge.core.requests.AppRequest
import com.gushenge.core.toast
import com.kyzh.core.dialog.showUpdateDialog

class UpdateApp {
    fun update(context: AppCompatActivity){
        AppRequest.updateApp(
            ASystem.getAppVersionCode(context), {
                context.showUpdateDialog(this){}
            }, {
                this.toast()
            }
        )
    }


    fun updateMain(context: AppCompatActivity, listener:() ->Unit){
        AppRequest.updateApp(
            ASystem.getAppVersionCode(context), {
            Log.e("RxDown", "updateMain: ", )
                context.showUpdateDialog(this,listener)

            }, {

                listener()
            }
        )
    }


}